home *** CD-ROM | disk | FTP | other *** search
/ mail.altrad.com / 2015.02.mail.altrad.com.tar / mail.altrad.com / TEST / office german / PROPLUS.WW / PROPLSWW.CAB / IPEDITOR.DLL / XML / EXPORTHTML.XSL < prev    next >
Text File  |  2006-10-27  |  39KB  |  1 lines

  1.  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msohtml="urn:office.microsoft.com:export:html" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xmlns:ms="urn:schemas-microsoft-com:xslt" extension-element-prefixes="msohtml" version="1.0"> <xsl:output encoding="utf-8" method="html" indent="no" version="1.0"/> <xsl:param name="infomailFlag" /> <xsl:template match="node()"> <xsl:choose> <xsl:when test="comment()"> <xsl:copy-of select="."/> </xsl:when> <xsl:when test="name()!=''"> <xsl:element name="{name()}"> <xsl:apply-templates select="@*|node()"/> </xsl:element> </xsl:when> <xsl:otherwise> <xsl:value-of select="."/> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="*[name()='body']"> <xsl:element name="{name()}"> <xsl:attribute name="lang"> <xsl:value-of select="msohtml:getLanguage()"/> </xsl:attribute> <xsl:if test="@background"> <xsl:attribute name="background"> <xsl:value-of select="msohtml:fixupUrl(string(@background))" /> </xsl:attribute> </xsl:if> <xsl:call-template name="style"> <xsl:with-param name="attr" select="@style"/> <xsl:with-param name="fStripMargin" select="true()"/> </xsl:call-template> <xsl:apply-templates select="@*[name()!='background' and name()!='style']"/> <xsl:value-of select="msohtml:getPreBody()" disable-output-escaping = "yes"/> <xsl:apply-templates select="node()"/> </xsl:element> </xsl:template> <xsl:template match="*[(name()='button' or (name()='input' and @type='button'))]"> <xsl:if test="contains(@style,'url(#default#DTPicker)')"> <xsl:element name="span"> <xsl:apply-templates select="@*"/> </xsl:element> </xsl:if> <xsl:if test="ancestor-or-self::*[name() = 'div' and @xd:SignatureBlock] and not(.//*[name()='img' and @src='x-res://infopath.exe/AddSignatureButton.gif'])"> <span> <xsl:apply-templates select="node() | @*[not(name() = 'style')]" /> </span> </xsl:if> </xsl:template> <xsl:template match="*[0 = ms:string-compare(name(), 'meta', '', 'i')] [@*[(0 = ms:string-compare(name(), 'http-equiv','','i')) and (0 = ms:string-compare(string(.), 'Content-Type', '', 'i'))]]"> </xsl:template> <xsl:template match="*[name()='table'][not(contains(@class, 'xdRepeatingTable'))][descendant::node()[contains(@class, 'xdRepeatingTable')]]" priority="1"> <xsl:element name="table"> <xsl:attribute name="style"> <xsl:call-template name="StripStyleValue"> <xsl:with-param name="style" select="@style"/> <xsl:with-param name="styleAttributeName" select="'TABLE-LAYOUT:'"/> </xsl:call-template> </xsl:attribute> <xsl:apply-templates select="@*[name()!='style']|node()"/> </xsl:element> </xsl:template> <xsl:template match="node()[(name()='td' and (ancestor::node()[name()='tbody'][1]/@valign='top' or ancestor::node()[name()='tbody'][1]/@vAlign='top')) or (name()='div' and *[name()='span' and (@xd:xctname='RepeatingSection' or @xd:xctname='LayoutRegion')])]" priority="1"> <xsl:choose> <xsl:when test="$infomailFlag"> <xsl:apply-templates select="." mode="HRTStart"/> </xsl:when> <xsl:otherwise> <xsl:choose> <xsl:when test="name()='td'"> <xsl:call-template name="generalTd"/> </xsl:when> <xsl:when test="contains(@style, 'PADDING') and not(@xd:xctname) and not(contains(@style, 'DISPLAY: none'))"> <xsl:call-template name="generalDiv"/> </xsl:when> <xsl:otherwise> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="node()[name()='td' and (ancestor::node()[name()='tbody'][1]/@valign='top' or ancestor::node()[name()='tbody'][1]/@vAlign='top')]" mode="HRTStart"> <xsl:element name="td"> <xsl:attribute name="style"> <xsl:text>vertical-align:top</xsl:text> <xsl:if test="@style!=''">;</xsl:if> <xsl:value-of select="@style"/> </xsl:attribute> <xsl:apply-templates select="@*[name()!='style']|node()"/> </xsl:element> </xsl:template> <xsl:template match="node()[name()='div' and *[name()='span' and (@xd:xctname='RepeatingSection' or @xd:xctname='LayoutRegion')]]" mode="HRTStart"> <xsl:element name="div"> <xsl:apply-templates select="@*" /> <xsl:apply-templates select="node()[not(name()='span' and (@xd:xctname='RepeatingSection' or @xd:xctname='LayoutRegion') and preceding-sibling::node()[1][name()='span' and (@xd:xctname='RepeatingSection' or @xd:xctname='LayoutRegion')])]" mode="HRT"/> </xsl:element> </xsl:template> <xsl:template match="node()" mode="HRT"> <xsl:choose> <xsl:when test="name()='span' and (@xd:xctname='RepeatingSection' or @xd:xctname='LayoutRegion')"> <xsl:element name="table"> <xsl:attribute name="style"> <xsl:text>margin-top: 2pt;border-collapse: collapse</xsl:text> </xsl:attribute> <xsl:element name="tr"> <xsl:apply-templates select="." mode="HRTSpan"/> <xsl:variable name="firstSpanPosition" select="count(preceding-sibling::node())" /> <xsl:apply-templates select="following-sibling::node()[name()='span' and (@xd:xctname='RepeatingSection' or @xd:xctname='LayoutRegion') and preceding-sibling::node()[1][name()='span' and (@xd:xctname='RepeatingSection' or @xd:xctname='LayoutRegion')] and not(preceding-sibling::node()[(name()!='span' or (@xd:xctname!='RepeatingSection' and @xd:xctname!='LayoutRegion')) and count(preceding-sibling::node())>$firstSpanPosition])]" mode="HRTSpan"/> </xsl:element> </xsl:element> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="." /> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="node()" mode="HRTSpan"> <xsl:element name="td"> <xsl:apply-templates select="@*|node()" /> </xsl:element> </xsl:template> <xsl:template match="node()[name()='tr']"> <xsl:variable name="styleafter" select="substring-after(string(@style), 'MIN-HEIGHT:')"/> <xsl:variable name="height" select="substring-before($styleafter, 'pt')"/> <xsl:element name="tr"> <xsl:attribute name="style"> <xsl:value-of select="@style"/> <xsl:if test="$infomailFlag and $height!=''"> <xsl:text>;height:</xsl:text> <xsl:value-of select="$height"/> <xsl:text>pt</xsl:text> </xsl:if> </xsl:attribute> <xsl:apply-templates select="node() | @*[name()!='style']" /> </xsl:element> </xsl:template> <xsl:template match="*[name()='span' and @xd:xctname='combobox']"> <span> <xsl:variable name="layoutStyle"> <xd:layoutStyle> <xsl:call-template name="style"> <xsl:with-param name="attr" select="*[name()='span' and @xd:xctname='PlainText']/@style"/> <xsl:with-param name="strPrepend">BORDER: 1px solid #dcdcdc; BACKGROUND-COLOR: #ffffff; PADDING-LEFT: 2px; PADDING-RIGHT: 2px; PADDING-TOP: 1px; PADDING-BOTTOM: 1px; FONT-SIZE: x-small; COLOR: windowtext; FONT-WEIGHT: normal; WHITE-SPACE: nowrap; OVERFLOW-X: hidden; TEXT-OVERFLOW: ellipsis</xsl:with-param> <xsl:with-param name="fStripBorder" select="true()"/> </xsl:call-template> </xd:layoutStyle> </xsl:variable> <xsl:variable name="preTxbxStyle"> <xsl:call-template name="style"> <xsl:with-param name="attr" select="@style"/> <xsl:with-param name="strPrepend"><xsl:value-of select="ms:node-set($layoutStyle)/xd:layoutStyle/@style"/></xsl:with-param> <xsl:with-param name="fStripBorder" select="true()"/> <xsl:with-param name="fTextOut" select="true()"/> <xsl:with-param name="fHeight" select="$infomailFlag"/> </xsl:call-template> </xsl:variable> <xsl:call-template name="insertTxbx"> <xsl:with-param name="style" select="$preTxbxStyle"/> </xsl:call-template> <xsl:apply-templates select="@*[name()!='style']"/> <xsl:copy-of select="*[name()='span' and @xd:xctname='PlainText']/@tabIndex"/> <xsl:value-of select="*[name()='span' and @xd:xctname='PlainText']" /> </span> </xsl:template> <xsl:template match="node()[@xd:xctname='DTPicker']"> <xsl:choose> <xsl:when test="$infomailFlag"> <xsl:apply-templates select="node()"/> </xsl:when> <xsl:otherwise> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates select="node()"/> </xsl:copy> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="insertRichText"> <xsl:variable name="fontFamily"> <xsl:call-template name="GetStyleValue"> <xsl:with-param name="style" select="ancestor-or-self::node()[contains(@style, 'FONT-FAMILY:')]/@style"/> <xsl:with-param name="styleAttributeName" select="'FONT-FAMILY:'"/> </xsl:call-template> </xsl:variable> <xsl:variable name="fontSize"> <xsl:call-template name="GetStyleValue"> <xsl:with-param name="style" select="ancestor-or-self::node()[contains(@style, 'FONT-SIZE:')]/@style"/> <xsl:with-param name="styleAttributeName" select="'FONT-SIZE:'"/> </xsl:call-template> </xsl:variable> <xsl:variable name="paddingLeft"> <xsl:call-template name="GetStyleValue"> <xsl:with-param name="style" select="@style"/> <xsl:with-param name="styleAttributeName" select="'PADDING-LEFT:'"/> </xsl:call-template> </xsl:variable> <xsl:variable name="paddingRight"> <xsl:call-template name="GetStyleValue"> <xsl:with-param name="style" select="@style"/> <xsl:with-param name="styleAttributeName" select="'PADDING-RIGHT:'"/> </xsl:call-template> </xsl:variable> <xsl:variable name="paddingTop"> <xsl:call-template name="GetStyleValue"> <xsl:with-param name="style" select="@style"/> <xsl:with-param name="styleAttributeName" select="'PADDING-TOP:'"/> </xsl:call-template> </xsl:variable> <xsl:variable name="paddingBottom"> <xsl:call-template name="GetStyleValue"> <xsl:with-param name="style" select="@style"/> <xsl:with-param name="styleAttributeName" select="'PADDING-BOTTOM:'"/> </xsl:call-template> </xsl:variable> <xsl:variable name="width"> <xsl:call-template name="GetStyleValue"> <xsl:with-param name="style" select="@style"/> <xsl:with-param name="styleAttributeName" select="'WIDTH:'"/> </xsl:call-template> </xsl:variable> <xsl:variable name="height"> <xsl:call-template name="GetStyleValue"> <xsl:with-param name="style" select="@style"/> <xsl:with-param name="styleAttributeName" select="'HEIGHT:'"/> </xsl:call-template> </xsl:variable> <table> <xsl:attribute name="style"> <xsl:value-of select="concat('PADDING-LEFT:', $paddingLeft, '; PADDING-RIGHT:', $paddingRight, '; PADDING-TOP:', $paddingTop, '; PADDING-BOTTOM:', $paddingBottom)" /> </xsl:attribute> <tr> <td> <xsl:attribute name="style"> <xsl:value-of select="concat('FONT-FAMILY:', $fontFamily, '; FONT-SIZE:', $fontSize, '; HEIGHT:', $height, '; WIDTH:', $width)" /> </xsl:attribute> <xsl:copy> <xsl:apply-templates select="@*[name()!='style']"/> <xsl:call-template name="style"> <xsl:with-param name="attr" select="@style"/> <xsl:with-param name="fStripMargin" select="true()"/> <xsl:with-param name="fStripPadding" select="true()"/> <xsl:with-param name="fStripBorder" select="true()"/> </xsl:call-template> <xsl:apply-templates select="node()"/> </xsl:copy> </td> </tr> </table> </xsl:template> <xsl:template match="node()[name()='span' and @xd:xctname='DTPicker_DTText']"> <xsl:element name="{name()}"> <xsl:variable name="preTxbxStyle"> <xsl:call-template name="style"> <xsl:with-param name="attr" select="@style" /> <xsl:with-param name="strPrepend" select="''"/> <xsl:with-param name="fTextOut" select="true()"/> <xsl:with-param name="fHeight" select="$infomailFlag"/> <xsl:with-param name="strAppend"> <xsl:choose> <xsl:when test="$infomailFlag"> <xsl:call-template name="style"> <xsl:with-param name="attr" select="../@style"/> <xsl:with-param name="strPrepend" select="''"/> <xsl:with-param name="fTextOut" select="true()"/> <xsl:with-param name="fHeight" select="$infomailFlag"/> <xsl:with-param name="strAppend" select="''"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="''"/> </xsl:otherwise> </xsl:choose> </xsl:with-param> </xsl:call-template> </xsl:variable> <xsl:call-template name="insertTxbx"> <xsl:with-param name="style" select="$preTxbxStyle"/> </xsl:call-template> <xsl:apply-templates select="@*[name()!='style']"/> <xsl:apply-templates select="node()"/> </xsl:element> </xsl:template> <xsl:template name="insertTxbx"> <xsl:param name="style" /> <xsl:param name="fOutputMSOElement" select="true()"/> <xsl:attribute name="style"> <xsl:value-of select="$style"/> <xsl:if test="$fOutputMSOElement"> <xsl:if test="$style!=''">;</xsl:if> <xsl:text>mso-element: ip-textbox</xsl:text> </xsl:if> </xsl:attribute> </xsl:template> <xsl:template match="*[name()='select']"> <xsl:element name="span"> <xsl:variable name="preTxbxStyle"> <xsl:call-template name="style"> <xsl:with-param name="attr" select="@style"/> <xsl:with-param name="strPrepend">BORDER: 1px solid #dcdcdc; BACKGROUND-COLOR: #ffffff; PADDING-LEFT: 2px; PADDING-RIGHT: 2px; PADDING-TOP: 1px; PADDING-BOTTOM: 1px; FONT-SIZE: x-small; COLOR: windowtext; FONT-WEIGHT: normal; WHITE-SPACE: nowrap; OVERFLOW-X: hidden; TEXT-OVERFLOW: ellipsis</xsl:with-param> <xsl:with-param name="fStripBorder" select="true()"/> <xsl:with-param name="fTextOut" select="true()"/> <xsl:with-param name="fHeight" select="$infomailFlag"/> </xsl:call-template> </xsl:variable> <xsl:call-template name="insertTxbx"> <xsl:with-param name="style" select="$preTxbxStyle"/> </xsl:call-template> <xsl:apply-templates select="@*[name()!='style']"/> <xsl:value-of select="*[name()='option'][@selected]"/> </xsl:element> </xsl:template> <xsl:template match="*[name()='input'][@type='checkbox' or @type='radio']"> <xsl:element name="span"> <xsl:attribute name="style">FONT-FAMILY:Verdana</xsl:attribute> <xsl:element name="font"> <xsl:attribute name="lang">en-us</xsl:attribute> <xsl:if test="@title"> <xsl:attribute name="title"><xsl:value-of select="@title"/></xsl:attribute> </xsl:if> <xsl:attribute name="face">Wingdings</xsl:attribute> <xsl:attribute name="style"> <xsl:value-of select="concat(@style,';DIRECTION: ltr; FONT-SIZE: medium; FONT-FAMILY: Wingdings')"/> </xsl:attribute> <xsl:choose> <xsl:when test="@CHECKED"> <xsl:choose> <xsl:when test="@type='checkbox'">þ</xsl:when> <xsl:when test="@type='radio'">¤</xsl:when> </xsl:choose> </xsl:when> <xsl:otherwise> <xsl:choose> <xsl:when test="@type='checkbox'">¨</xsl:when> <xsl:when test="@type='radio'">¡</xsl:when> </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:element> </xsl:element> </xsl:template> <xsl:template match="*[contains(@style,'url(#default#xOptional)')]" priority="10"/> <xsl:template match="*[contains(@style, 'DISPLAY: none')]" priority="2"/> <xsl:template match="*[name()='ol' or name()='ul' or (name()='span' and (name(..)='li' or name(child::*[1])='ol' or name(child::*[1])='ul'))]"> <xsl:element name="{name()}"> <xsl:call-template name="style"> <xsl:with-param name="attr" select="@style"/> <xsl:with-param name="fStripBorder" select="true()"/> <xsl:with-param name="fStripDisplay" select="true()"/> <xsl:with-param name="fStripPadding" select="true()"/> </xsl:call-template> <xsl:apply-templates select="@*[name()!='style']|node()"/> </xsl:element> </xsl:template> <xsl:template match="*[name()='li']"> <xsl:choose> <xsl:when test="contains(../@style, 'LIST-STYLE-TYPE: none')"> <xsl:element name="p"> <xsl:call-template name="style"> <xsl:with-param name="attr" select="@style"/> <xsl:with-param name="strPrepend">MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px;</xsl:with-param> <xsl:with-param name="fStripDisplay" select="true()"/> </xsl:call-template> <xsl:apply-templates select="@*[name()!='style']|node()"/> </xsl:element> </xsl:when> <xsl:otherwise> <xsl:element name="{name()}"> <xsl:call-template name="style"> <xsl:with-param name="attr" select="@style"/> <xsl:with-param name="fStripDisplay" select="true()"/> </xsl:call-template> <xsl:apply-templates select="@*[name()!='style']|node()"/> </xsl:element> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="*[name()='hr']"> <xsl:element name="{name()}"> <xsl:if test="not(@align)"> <xsl:attribute name="align">left</xsl:attribute> </xsl:if> <xsl:apply-templates select="@*"/> </xsl:element> </xsl:template> <xsl:template match="*[name()='td']" name="generalTd"> <xsl:element name="{name()}"> <xsl:call-template name="style"> <xsl:with-param name="attr" select="@style"/> <xsl:with-param name="strPrepend" select="ancestor::node()[name()='tbody'][1]/@style"/> </xsl:call-template> <xsl:apply-templates select="@*[name()!='style']"/> <xsl:choose> <xsl:when test="child::node()"> <xsl:apply-templates select="node()"/> </xsl:when> <xsl:otherwise> <xsl:text> </xsl:text> </xsl:otherwise> </xsl:choose> </xsl:element> </xsl:template> <xsl:template match="@*[name()='style' and name(..)='tbody']"/> <xsl:template match="*[contains(@style,'url(#default#TextField)') or contains(@style,'url(#default#Dummy)')]" priority="1"> <xsl:choose> <xsl:when test="@xd:xctname='RichText'"> <xsl:text disable-output-escaping="yes"><!--[if mso]></xsl:text> <xsl:call-template name="insertRichText" /> <xsl:text disable-output-escaping="yes"><![endif]--></xsl:text> <xsl:text disable-output-escaping="yes"><!--[if !mso]></xsl:text> <xsl:choose> <xsl:when test="contains(@style,'DISPLAY: inline-block')"> <span> <xsl:call-template name="textField"> <xsl:with-param name="fOutputMSOElement" select="false()"/> </xsl:call-template> </span> </xsl:when> <xsl:otherwise> <xsl:call-template name="textField"> <xsl:with-param name="fOutputMSOElement" select="false()"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> <xsl:text disable-output-escaping="yes"><![endif]--></xsl:text> </xsl:when> <xsl:when test="contains(@style,'DISPLAY: inline-block')"> <span> <xsl:call-template name="textField"/> </span> </xsl:when> <xsl:otherwise> <xsl:call-template name="textField"/> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="textField" > <xsl:param name="fOutputMSOElement" select="true()"/> <xsl:variable name="strUppercaseStyle"><xsl:value-of select="translate(@style, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/></xsl:variable> <xsl:variable name="strNormalizedStyle"><xsl:value-of select="concat(substring-before($strUppercaseStyle,'TEXT-OVERFLOW'),substring-after($strUppercaseStyle,'TEXT-OVERFLOW'))"/></xsl:variable> <xsl:variable name="fStripBorder"> <xsl:choose> <xsl:when test="not(contains($strNormalizedStyle, 'WHITE-SPACE: NOWRAP'))">strip_border</xsl:when> <xsl:when test="not(contains($strNormalizedStyle, 'OVERFLOW-Y: HIDDEN') or contains($strNormalizedStyle,'OVERFLOW: HIDDEN'))">strip_border</xsl:when> <xsl:otherwise>preserve_border</xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:element name="{name()}"> <xsl:choose> <xsl:when test="@xd:ghosted='true'"> <xsl:apply-templates select="@*|node()[name()!='']"/> <xsl:text> </xsl:text> </xsl:when> <xsl:when test="ancestor::node()[name()='span' and @xd:xctname='multiselectlistbox'] or parent::node()[name()='li']"> <xsl:call-template name="style"> <xsl:with-param name="attr" select="@style"/> <xsl:with-param name="fStripBorder" select="contains($fStripBorder,'strip')"/> </xsl:call-template> <xsl:apply-templates select="@*[name()!='style']|node()"/> </xsl:when> <xsl:otherwise> <xsl:variable name="preTxbxStyle"> <xsl:call-template name="style"> <xsl:with-param name="attr" select="@style"/> <xsl:with-param name="fStripBorder" select="contains($fStripBorder,'strip')"/> <xsl:with-param name="fTextOut" select="true()"/> <xsl:with-param name="fHeight" select="$infomailFlag"/> </xsl:call-template> </xsl:variable> <xsl:call-template name="insertTxbx"> <xsl:with-param name="style" select="$preTxbxStyle"/> <xsl:with-param name="fOutputMSOElement" select="$fOutputMSOElement"/> </xsl:call-template> <xsl:apply-templates select="@*[name()!='style']|node()"/> </xsl:otherwise> </xsl:choose> </xsl:element> </xsl:template> <xsl:template match="*[name()='div' and contains(@style, 'PADDING') and not(@xd:xctname) and not(contains(@style, 'DISPLAY: none'))]" name="generalDiv"> <xsl:copy> <xsl:attribute name="style"> <xsl:choose> <xsl:when test="contains(@style, 'PADDING-LEFT:')"> <xsl:value-of select="substring-before(@style, 'PADDING-LEFT:')"/> <xsl:text>MARGIN-LEFT:</xsl:text> <xsl:value-of select="substring-after(@style, 'PADDING-LEFT:')"/> </xsl:when> <xsl:when test="contains(@style, 'PADDING-RIGHT:')"> <xsl:value-of select="substring-before(@style, 'PADDING-RIGHT:')"/> <xsl:text>MARGIN-RIGHT:</xsl:text> <xsl:value-of select="substring-after(@style, 'PADDING-RIGHT:')"/> </xsl:when> </xsl:choose> </xsl:attribute> <xsl:apply-templates select="@*[name()!='style']|node()"/> </xsl:copy> </xsl:template> <xsl:template match="*[name()='span' and contains(@style,'DISPLAY: inline-block')]"> <xsl:element name="span"> <xsl:choose> <xsl:when test="contains(@class,'xdFileAttachment')"> <xsl:value-of disable-output-escaping="yes" select="msohtml:getFileAttachmentHTML(.)"/> </xsl:when> <xsl:otherwise> <xsl:element name="span"> <xsl:apply-templates select="@*|node()"/> </xsl:element> </xsl:otherwise> </xsl:choose> </xsl:element> </xsl:template> <xsl:template match="@*"> <xsl:copy> <xsl:apply-templates select="@*"/> </xsl:copy> </xsl:template> <xsl:template match="@*[starts-with(name(),'xd:')] | @class | @contentEditable | @ms__html_xselstate"/> <xsl:template match="*[name()='img']"> <xsl:element name="{name()}"> <xsl:variable name="strStyle"> <xsl:value-of select="concat(@style,';')"/> </xsl:variable> <xsl:attribute name="src"> <xsl:value-of select="msohtml:fixupUrl(string(@src))"/> </xsl:attribute> <xsl:choose> <xsl:when test="contains($strStyle,'WIDTH:')"> <xsl:attribute name="width"> <xsl:value-of select="msohtml:convertWidthToPx(normalize-space(substring-before(substring-after($strStyle,'WIDTH:'),';')))"/> </xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:copy-of select="@width"/> </xsl:otherwise> </xsl:choose> <xsl:choose> <xsl:when test="contains($strStyle,'HEIGHT:')"> <xsl:attribute name="height"> <xsl:value-of select="msohtml:convertHeightToPx(normalize-space(substring-before(substring-after($strStyle,'HEIGHT:'),';')))"/> </xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:copy-of select="@height"/> </xsl:otherwise> </xsl:choose> <xsl:apply-templates select="@*[name()!='src' and name()!='width' and name()!='height' and name()!='alt']|node()"/> </xsl:element> </xsl:template> <xsl:template name="style" match="@style"> <xsl:param name="attr" select="."/> <xsl:param name="strPrepend"/> <xsl:param name="fStripBorder" select="false()"/> <xsl:param name="fStripDisplay" select="false()"/> <xsl:param name="fStripMargin" select="false()"/> <xsl:param name="fStripPadding" select="false()"/> <xsl:param name="fTextOut" select="false()"/> <xsl:param name="fHeight" select="false()"/> <xsl:param name="strAppend"/> <xsl:variable name="style"> <xsl:call-template name="parseStyle"> <xsl:with-param name="style" select="normalize-space($attr)"/> <xsl:with-param name="fStripBorder" select="$fStripBorder"/> <xsl:with-param name="fStripDisplay" select="$fStripDisplay"/> <xsl:with-param name="fStripMargin" select="$fStripMargin"/> <xsl:with-param name="fStripPadding" select="$fStripPadding"/> <xsl:with-param name="fStripHeight"> <xsl:choose> <xsl:when test="$fHeight and $attr/../@xd:xctname='RichText' and not(contains($attr, 'OVERFLOW-Y')) and $attr/../node()"> <xsl:text>strip</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>nostrip</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:with-param> </xsl:call-template> </xsl:variable> <xsl:choose> <xsl:when test="$style!=''"> <xsl:choose> <xsl:when test="$fTextOut"> <xsl:choose> <xsl:when test="$strPrepend!=''"> <xsl:value-of select="concat($strPrepend, '; ', $style)"/> <xsl:if test="$fHeight"> <xsl:call-template name="infomailHeight"> <xsl:with-param name="context" select="$attr"/> <xsl:with-param name="style" select="concat($strPrepend, '; ', $style)"/> </xsl:call-template> </xsl:if> </xsl:when> <xsl:when test="$strAppend!=''"> <xsl:value-of select="concat($style, '; ', $strAppend)"/> <xsl:if test="$fHeight"> <xsl:call-template name="infomailHeight"> <xsl:with-param name="context" select="$attr"/> <xsl:with-param name="style" select="concat($style, '; ', $strAppend)"/> </xsl:call-template> </xsl:if> </xsl:when> <xsl:otherwise> <xsl:value-of select="$style"/> <xsl:if test="$fHeight"> <xsl:call-template name="infomailHeight"> <xsl:with-param name="context" select="$attr"/> <xsl:with-param name="style" select="$style"/> </xsl:call-template> </xsl:if> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> <xsl:attribute name="style"> <xsl:choose> <xsl:when test="$strPrepend!=''"> <xsl:value-of select="concat($strPrepend, '; ', $style)"/> <xsl:if test="$fHeight"> <xsl:call-template name="infomailHeight"> <xsl:with-param name="context" select="$attr"/> <xsl:with-param name="style" select="concat($strPrepend, '; ', $style)"/> </xsl:call-template> </xsl:if> </xsl:when> <xsl:when test="$strAppend!=''"> <xsl:value-of select="concat($style, '; ', $strAppend)"/> <xsl:if test="$fHeight"> <xsl:call-template name="infomailHeight"> <xsl:with-param name="context" select="$attr"/> <xsl:with-param name="style" select="concat($style, '; ', $strAppend)"/> </xsl:call-template> </xsl:if> </xsl:when> <xsl:otherwise> <xsl:value-of select="$style"/> <xsl:if test="$fHeight"> <xsl:call-template name="infomailHeight"> <xsl:with-param name="context" select="$attr"/> <xsl:with-param name="style" select="$style"/> </xsl:call-template> </xsl:if> </xsl:otherwise> </xsl:choose> </xsl:attribute> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> <xsl:choose> <xsl:when test="$fTextOut"> <xsl:choose> <xsl:when test="$strPrepend!=''"> <xsl:value-of select="$strPrepend"/> <xsl:if test="$fHeight"> <xsl:call-template name="infomailHeight"> <xsl:with-param name="context" select="$attr"/> <xsl:with-param name="style" select="$strPrepend"/> </xsl:call-template> </xsl:if> </xsl:when> <xsl:when test="$strAppend!=''"> <xsl:value-of select="$strAppend"/> <xsl:if test="$fHeight"> <xsl:call-template name="infomailHeight"> <xsl:with-param name="context" select="$attr"/> <xsl:with-param name="style" select="$strAppend"/> </xsl:call-template> </xsl:if> </xsl:when> </xsl:choose> </xsl:when> <xsl:otherwise> <xsl:if test="$strPrepend!=''"> <xsl:attribute name="style"> <xsl:value-of select="$strPrepend"/> <xsl:if test="$fHeight"> <xsl:call-template name="infomailHeight"> <xsl:with-param name="context" select="$attr"/> <xsl:with-param name="style" select="$strPrepend"/> </xsl:call-template> </xsl:if> </xsl:attribute> </xsl:if> </xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="parseStyle"> <xsl:param name="style"/> <xsl:param name="fStripBorder"/> <xsl:param name="fStripDisplay"/> <xsl:param name="fStripMargin"/> <xsl:param name="fStripPadding"/> <xsl:param name="fStripHeight"/> <xsl:choose> <xsl:when test="contains($style, ';')"> <xsl:variable name="before"> <xsl:call-template name="parseStyle"> <xsl:with-param name="style" select="normalize-space(substring-before($style,';'))"/> <xsl:with-param name="fStripBorder" select="$fStripBorder"/> <xsl:with-param name="fStripDisplay" select="$fStripDisplay"/> <xsl:with-param name="fStripMargin" select="$fStripMargin"/> <xsl:with-param name="fStripPadding" select="$fStripPadding"/> <xsl:with-param name="fStripHeight" select="$fStripHeight"/> </xsl:call-template> </xsl:variable> <xsl:variable name="after"> <xsl:call-template name="parseStyle"> <xsl:with-param name="style" select="normalize-space(substring-after($style,';'))"/> <xsl:with-param name="fStripBorder" select="$fStripBorder"/> <xsl:with-param name="fStripDisplay" select="$fStripDisplay"/> <xsl:with-param name="fStripMargin" select="$fStripMargin"/> <xsl:with-param name="fStripPadding" select="$fStripPadding"/> <xsl:with-param name="fStripHeight" select="$fStripHeight"/> </xsl:call-template> </xsl:variable> <xsl:if test="$before!='' or $after!=''"> <xsl:choose> <xsl:when test="$after=''"> <xsl:value-of select="$before"/> </xsl:when> <xsl:when test="$before=''"> <xsl:value-of select="$after"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="concat($before, '; ', $after)"/> </xsl:otherwise> </xsl:choose> </xsl:if> </xsl:when> <xsl:otherwise> <xsl:choose> <xsl:when test=" ($fStripBorder and starts-with($style, 'BORDER')) or ($fStripDisplay and starts-with($style, 'DISPLAY')) or ($fStripMargin and starts-with($style, 'MARGIN')) or ($fStripPadding and starts-with($style, 'PADDING')) or starts-with($style, 'mso-') or starts-with($style, 'ms__unique') or starts-with($style, 'POSITION') or contains($style, '#default#urn::controls/Binder') or contains($style, '#default#urn::tables/NDTable') or contains($style, '#default#ComboBox') or ($fStripHeight='strip' and starts-with($style, 'HEIGHT')) "> </xsl:when> <xsl:when test="starts-with($style, 'WIDTH') and contains($style, '%') and $infomailFlag"> <xsl:variable name="pct" select="number(translate($style, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz%: ', '')) div 100"/> <xsl:choose> <xsl:when test="ancestor::node()[@width][1]/@width"> <xsl:value-of select="concat('WIDTH:', $pct * ancestor::node()[@width][1]/@width, 'px')"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$style"/> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> <xsl:value-of select="$style"/> </xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="infomailHeight"> <xsl:param name="context"/> <xsl:param name="style"/> <xsl:if test="not(contains($style, ';HEIGHT:') or contains($style, ' HEIGHT:')) and $context/../@xd:xctname!='RichText' and not($context/../@xd:xctname='PlainText' and contains($context/../@xd:datafmt, 'plainMultiline') and contains($context, 'OVERFLOW-Y: visible')) and not(contains($context/ancestor::node()/@style, 'LAYOUT-GRID:'))"> <xsl:if test="$style!=''"> <xsl:text>;</xsl:text> </xsl:if> <xsl:variable name="styleAfter"> <xsl:choose> <xsl:when test="contains($style, 'FONT-SIZE')"> <xsl:call-template name="substring-after-last"> <xsl:with-param name="haystack" select="$style" /> <xsl:with-param name="needle" select="'FONT-SIZE:'" /> </xsl:call-template> </xsl:when> <xsl:when test="contains($style, 'font-size:')"> <xsl:call-template name="substring-after-last"> <xsl:with-param name="haystack" select="$style" /> <xsl:with-param name="needle" select="'font-size:'" /> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:variable name="bodyStyle" select="//*[name()='body']/@style"/> <xsl:choose> <xsl:when test="contains($bodyStyle, 'FONT-SIZE')"> <xsl:call-template name="substring-after-last"> <xsl:with-param name="haystack" select="$bodyStyle" /> <xsl:with-param name="needle" select="'FONT-SIZE:'" /> </xsl:call-template> </xsl:when> <xsl:when test="contains($bodyStyle, 'font-size:')"> <xsl:call-template name="substring-after-last"> <xsl:with-param name="haystack" select="$bodyStyle" /> <xsl:with-param name="needle" select="'font-size:'" /> </xsl:call-template> </xsl:when> </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="fontSize"> <xsl:call-template name="getFontSize"> <xsl:with-param name="style"> <xsl:choose> <xsl:when test="contains($styleAfter, ';')"> <xsl:value-of select="substring-before($styleAfter, ';')"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$styleAfter"/> </xsl:otherwise> </xsl:choose> </xsl:with-param> </xsl:call-template> </xsl:variable> <xsl:variable name="paddingTop"> <xsl:call-template name="GetStyleValue"> <xsl:with-param name="style" select="$style"/> <xsl:with-param name="styleAttributeName" select="'PADDING-TOP:'"/> </xsl:call-template> </xsl:variable> <xsl:variable name="paddingBottom"> <xsl:call-template name="GetStyleValue"> <xsl:with-param name="style" select="$style"/> <xsl:with-param name="styleAttributeName" select="'PADDING-BOTTOM:'"/> </xsl:call-template> </xsl:variable> <xsl:variable name="borderTop"> <xsl:variable name="borderTopString"> <xsl:call-template name="GetStyleValue"> <xsl:with-param name="style" select="$style"/> <xsl:with-param name="styleAttributeName" select="'BORDER-TOP: #'"/> <xsl:with-param name="styleAttributeSeparator" select="'pt'"/> </xsl:call-template> </xsl:variable> <xsl:choose> <xsl:when test="contains($borderTopString, ' ')"> <xsl:value-of select="substring-after($borderTopString, ' ')"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="0"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="borderBottom"> <xsl:variable name="borderBottomString"> <xsl:call-template name="GetStyleValue"> <xsl:with-param name="style" select="$style"/> <xsl:with-param name="styleAttributeName" select="'BORDER-BOTTOM: #'"/> <xsl:with-param name="styleAttributeSeparator" select="'pt'"/> </xsl:call-template> </xsl:variable> <xsl:choose> <xsl:when test="contains($borderBottomString, ' ')"> <xsl:value-of select="substring-after($borderBottomString, ' ')"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="0"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:text>height:</xsl:text> <xsl:value-of select="number($fontSize) + 2 * ceiling(number($fontSize) div 6) + number(substring-before(msohtml:convertHeightToPt(string($paddingTop)), 'pt')) - number($borderTop) div 2 + number(substring-before(msohtml:convertHeightToPt(string($paddingBottom)), 'pt')) - number($borderBottom) div 2 "/> <xsl:text>pt</xsl:text> </xsl:if> </xsl:template> <xsl:template name="substring-after-last"> <xsl:param name="haystack" /> <xsl:param name="needle" /> <xsl:choose> <xsl:when test="contains($haystack, $needle)"> <xsl:call-template name="substring-after-last"> <xsl:with-param name="haystack" select="substring-after($haystack, $needle)" /> <xsl:with-param name="needle" select="$needle" /> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$haystack" /> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="getFontSize"> <xsl:param name="style"/> <xsl:choose> <xsl:when test="contains($style, 'pt')"> <xsl:value-of select="substring-before($style, 'pt')"/> </xsl:when> <xsl:otherwise> <xsl:variable name="trimStyle" select="normalize-space($style)"/> <xsl:choose> <xsl:when test="$trimStyle='xx-small' or $trimStyle='XX-SMALL'"> <xsl:text>8</xsl:text> </xsl:when> <xsl:when test="$trimStyle='x-small' or $trimStyle='X-SMALL'"> <xsl:text>10</xsl:text> </xsl:when> <xsl:when test="$trimStyle='small' or $trimStyle='SMALL'"> <xsl:text>12</xsl:text> </xsl:when> <xsl:when test="$trimStyle='medium' or $trimStyle='MEDIUM'"> <xsl:text>14</xsl:text> </xsl:when> <xsl:when test="$trimStyle='large' or $trimStyle='LARGE'"> <xsl:text>18</xsl:text> </xsl:when> <xsl:when test="$trimStyle='x-large' or $trimStyle='X-LARGE'"> <xsl:text>24</xsl:text> </xsl:when> <xsl:when test="$trimStyle='xx-large' or $trimStyle='XX-LARGE'"> <xsl:text>36</xsl:text> </xsl:when> <xsl:otherwise> <xsl:text>10</xsl:text> </xsl:otherwise> </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="*[name()='object']" priority="1"> <xsl:element name="img"> <xsl:attribute name="src"> <xsl:value-of select="msohtml:getObjectSnapshotUrl(string(@src), string(@xd:CtrlId), string(@class))"/> </xsl:attribute> <xsl:call-template name="style"> <xsl:with-param name="attr" select="@style"/> </xsl:call-template> <xsl:copy-of select="@tabindex"/> <xsl:copy-of select="@title"/> </xsl:element> </xsl:template> <xsl:template match="*[name()='table'][not(contains(@style, 'BACKGROUND-COLOR'))]"> <xsl:copy> <xsl:variable name="strPrepend"> <xsl:variable name="firstAncestorStyleWithBGColor" select="ancestor::*[not(name()='body')][contains(@style, 'BACKGROUND-COLOR')]/@style"/> <xsl:if test="$firstAncestorStyleWithBGColor"> <xsl:text>BACKGROUND-COLOR:</xsl:text> <xsl:call-template name="GetStyleValue"> <xsl:with-param name="style" select="$firstAncestorStyleWithBGColor"/> <xsl:with-param name="styleAttributeName" select="'BACKGROUND-COLOR:'"/> </xsl:call-template> </xsl:if> </xsl:variable> <xsl:call-template name="style"> <xsl:with-param name="attr" select="@style"/> <xsl:with-param name="strPrepend" select="$strPrepend"/> </xsl:call-template> <xsl:apply-templates select="@*[name()!='style']|node()"/> </xsl:copy> </xsl:template> <xsl:template match="*[name()='span' and @xd:xctname='multiselectlistbox']"> <span> <xsl:attribute name="title"> <xsl:value-of select="@title"/> </xsl:attribute> <xsl:variable name="currentBackgroundColor"> <xsl:call-template name="GetStyleValue"> <xsl:with-param name="style" select="@style"/> <xsl:with-param name="styleAttributeName" select="'BACKGROUND-COLOR:'"/> </xsl:call-template> </xsl:variable> <xsl:variable name="newBackgroundColor"> <xsl:choose> <xsl:when test="$infomailFlag and $currentBackgroundColor='transparent'"> <xsl:variable name="firstAncestorStyleWithBGColor" select="ancestor::*[contains(@style, 'BACKGROUND-COLOR')]/@style"/> <xsl:call-template name="GetStyleValue"> <xsl:with-param name="style" select="$firstAncestorStyleWithBGColor"/> <xsl:with-param name="styleAttributeName" select="'BACKGROUND-COLOR:'"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$currentBackgroundColor"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="style"> <xsl:value-of select="substring-before(@style, 'BACKGROUND-COLOR:')"/> <xsl:text>BACKGROUND-COLOR:</xsl:text> <xsl:value-of select="$newBackgroundColor"/> <xsl:text>;</xsl:text> <xsl:value-of select="substring-after(substring-after(@style, 'BACKGROUND-COLOR:'), ';')"/> </xsl:variable> <xsl:call-template name="insertTxbx"> <xsl:with-param name="style" select="$style"/> </xsl:call-template> <xsl:for-each select="node()[name()='span']"> <xsl:apply-templates select="node()"/> <xsl:if test="following-sibling::*[name()='span']"> <br/> </xsl:if > </xsl:for-each> </span> </xsl:template> <xsl:template name="GetStyleValue"> <xsl:param name="style"/> <xsl:param name="styleAttributeName"/> <xsl:param name="styleAttributeSeparator" select="';'"/> <xsl:choose> <xsl:when test="$styleAttributeName!='' and contains($style, $styleAttributeName)"> <xsl:variable name="substringAfter" select="substring-after($style, $styleAttributeName)"/> <xsl:choose> <xsl:when test="contains($substringAfter, $styleAttributeSeparator)"> <xsl:value-of select="normalize-space(substring-before($substringAfter, $styleAttributeSeparator))"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="normalize-space($substringAfter)"/> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> <xsl:value-of select="''"/> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="StripStyleValue"> <xsl:param name="style"/> <xsl:param name="styleAttributeName"/> <xsl:param name="styleAttributeSeparator" select="';'"/> <xsl:choose> <xsl:when test="$styleAttributeName!='' and contains($style, $styleAttributeName)"> <xsl:variable name="before" select="substring-before($style, $styleAttributeName)"/> <xsl:variable name="after" select="substring-after(substring-after($style, $styleAttributeName), $styleAttributeSeparator)"/> <xsl:value-of select="concat($before, '; ', $after)"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$style"/> </xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet>